﻿<%@ Page Title="" Language="C#" MasterPageFile="~/edit/Admin.Master" AutoEventWireup="true" CodeBehind="SqlStatementList.aspx.cs" Inherits="ChgDoc.Edit.SqlStatementList" %>
<asp:Content ID="header" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="../script/edittextdialog.js"></script>
<script type="text/javascript" src="../script/catchtab.js"></script>
<script type="text/javascript">
    function editSql(code, sql) {

        var editText = new editTextDialog({
            title: 'Edit SQL',
            text: unescape(sql),
            ok: function (text) {
                var submitData = '{ code : "' + code + '", sql: "' + text + '"}';
                doAjax(appGlobal.serverUrl + 'service/sqlstatement.asmx/UpdateSql', submitData);                
            }
        });

        editText.show();
    }

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pageContent" runat="server">
    <div class="formStyle">
	    <div style="padding: 20px;">

		
	    <asp:datagrid id="grdList" runat="server" autogeneratecolumns="false" CssClass="grid" OnItemCommand="grdList_ItemCommand" OnEditCommand="grdList_Edit" OnCancelCommand="grdList_Cancel" OnUpdateCommand="grdList_Update" OnItemDataBound="grdList_ItemDataBound" >
	    <HeaderStyle CssClass="gridHeader" />
	    <columns>
		    <asp:BoundColumn DataField="Id" visible="false" readonly="true" />
            <asp:BoundColumn DataField="Code" visible="true" HeaderText="Code" />            
            <asp:BoundColumn DataField="Sql" visible="true" HeaderText="Sql" />            
            <asp:BoundColumn DataField="Param" visible="true" HeaderText="Param" />            
            <asp:BoundColumn DataField="Sql" visible="false" />                        
            <asp:EditCommandColumn ButtonType="LinkButton" EditText="Edit" CancelText="Cancel" UpdateText="Save" />
		    <asp:ButtonColumn ButtonType="Linkbutton" CommandName="Delete" Text="Delete" />
	    </columns>
	    </asp:datagrid>

        <br />
        
        <table cellspacing="0" cellpadding="0" class="std">
            <tr class="head"><td colspan="2"><h5>New Location</h5></td></tr>
            <tr class="gray"><td class="lbl">Code</td><td><asp:TextBox ID="txtCode" runat="server" class="txtbox" /></td></tr>
            <tr class="gray"><td class="lbl">Sql</td><td><asp:TextBox ID="txtSql" runat="server" class="txtbox" /></td></tr>
            <tr class="gray"><td class="lbl">Param</td><td><asp:TextBox ID="txtParam" runat="server" class="txtbox" /></td></tr>

            <tr><td></td><td ><asp:Button ID="btnAdd" Text="save" OnClick="btnAdd_click" runat="server" class="ui-state-default" /></td></tr>
        </table>
	
        
    </div>

</asp:Content>
